home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10573 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  42 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.sprintlink.net!news1!ind-004-236-166
  3. From: dlmiller@iquest.net (Doug Miller)
  4. Subject: Re: operator % - compiler error
  5. X-Nntp-Posting-Host: ind-002-236-107.iquest.net
  6. Message-ID: <DoH503.Hu7@iquest.net>
  7. Sender: news@iquest.net (News Admin)
  8. Organization: IQuest Network Services
  9. X-Newsreader: News Xpress Version 1.0 Beta #2.1
  10. References: <4ihuuh$6ul@hatathli.csulb.edu>
  11. Date: Mon, 18 Mar 1996 17:40:38 GMT
  12.  
  13. davidcho@csulb.edu (David Cho) wrote:
  14. +Xref: news1 comp.lang.c:71018
  15. +Path: news1!news.sprintlink.net!usenet.kornet.nm.kr!usenet.hana.nm.kr!usenet.seri.re.kr!news.cais.net!news.ac.net!imci4!newsfeed.internetmci.com!info.ucla.edu!library.ucla.edu!csulb.edu!davidcho
  16. +From: davidcho@csulb.edu (David Cho)
  17. +Newsgroups: comp.lang.c
  18. +Subject: operator % - compiler error
  19. +Date: 17 Mar 1996 21:07:29 GMT
  20. +Organization: Cal State Long Beach
  21. +Lines: 7
  22. +Message-ID: <4ihuuh$6ul@hatathli.csulb.edu>
  23. +NNTP-Posting-Host: heart.engr.csulb.edu
  24. +X-Newsreader: TIN [version 1.2 PL2]
  25. +
  26. +When I try to compile, I get an erro message for the following line:
  27. +
  28. +
  29. +x=663608941*y%pow(2,32)  /*I want remainder*/
  30. +
  31. +But the error message says "illegal use of floating point".  What does
  32. +that mean?  Isn't % used a an operator to calcuate the remainder?
  33.  
  34. You're right that % is the modulo operator.
  35.  
  36. Hard to say for sure what caused the error, as you have not posted the declarations of x and y.
  37. But here are some suggestions. Remember that * is the indirection operator, as well as the
  38. multiplication operator; try putting spaces before and after the * so the compiler knows what
  39. you mean.  Do the same with the % operator.  And remember you need a semicolon at the end
  40. of your statement.
  41.  
  42.